package com.ruix.app.widget.chatrow;

import android.content.Context;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hyphenate.chat.EMMessage;
import com.hyphenate.easeui.model.styles.EaseMessageListItemStyle;
import com.hyphenate.easeui.widget.EaseChatMessageList;
import com.hyphenate.easeui.widget.chatrow.EaseChatRow;
import com.ruix.app.R;

/**
 * Created by hadexs on 2017/5/29.
 */

public class ChatRowMute extends EaseChatRow {


    private TextView muteMessageView;

    public ChatRowMute(Context context, EMMessage message, int position, BaseAdapter adapter) {
        super(context, message, position, adapter);
    }

    @Override
    protected void onInflateView() {
        inflater.inflate(R.layout.ease_row_received_mute,this);
    }

    @Override
    protected void onFindViewById() {
        muteMessageView = (TextView) findViewById(R.id.tv_mute_message_view);
    }

    @Override
    protected void onUpdateView() {
    }

    public void setUpView(EMMessage message, int position,
                          EaseChatMessageList.MessageListItemClickListener itemClickListener,
                          EaseMessageListItemStyle itemStyle) {
        this.message = message;
        this.position = position;
        this.itemClickListener = itemClickListener;
        this.itemStyle = itemStyle;
        onSetUpView();
    }

    @Override
    protected void onSetUpView() {
        try {
            String type =  message.getStringAttribute("type");
            if ("mute".equals(type)){
                muteMessageView.setText("当前仅导师发言");
            }else if ("unmute".equals(type)) { //
                muteMessageView.setText("大家可自由发言");
            }
        } catch (Exception e){

        }
    }

    @Override
    protected void onBubbleClick() {

    }
}
